package com.maopuyu.services;


import com.maopuyu.entity.Series;
import com.maopuyu.entity.Video;
import com.maopuyu.repositories.SeriesRepository;
import com.maopuyu.repositories.VideoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class SeriesService {
    @Autowired
    private SeriesRepository seriesRepository;

    public List<Series> findSeriesByRegion(Integer id) {
        if (id == 0) {
            return seriesRepository.findAll();
        }
        return seriesRepository.findAllByRegionId(id);
    }

}
